package sxh.service;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import sxh.springMvc.druidUtil;

@Service
public class CacheService {
	@Cacheable(value="mycache", key="#map['vclid']")
	public String getData(Map<String,Object>map){
		try {
			Thread.sleep(3000);
			
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return "1";
	}
	
	@CachePut(value="mycache", key="#map['vclid']")
	public String getDataUpdate(Map<String,Object>map){
		try {
			Thread.sleep(3000);
			
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return "1";
	}
	@CachePut(value="mycache", key="#vclid")
	public String getDataUpdate1(String vclid){
		try {
			Thread.sleep(3000);
			
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return "1";
	}
	@Cacheable(value="mycache", key="#vclid")
	public String getData(String vclid){
		try {
			Thread.sleep(3000);
			
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return "1";
	}
	@CacheEvict(value="mycache", key="#vclid")
	public String remove(String vclid){
		try {
			Thread.sleep(3000);
			
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return "1";
	}
}
